package br.com.verde.exemploteca.implicitconversion

object TimesStringOperator {
  implicit def intTimesStringOperator(n: Int) = new IntTimesStringOperator(n) 
}

class IntTimesStringOperator(n: Int) {
  def *(s: String) = {
    def stringNTimes(original: String, s: String, n: Int): String = n match {
      case 1 => s
      case _ => stringNTimes(original, s + original, n - 1)
    }  
    stringNTimes(s, s, n)
  }
} 
